/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 22652
 * Date: 2024-03-31
 * Time: 22:14
 */
public class test_6 {
    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(()->{
            while (true){
                System.out.println("创建的新线程应该做的任务内容");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                    try {
                        System.out.println("11111111111111111111");
                        Thread.sleep(3000);
                    } catch (InterruptedException ex) {
                        System.out.println("22222222222222222222");
                        e.printStackTrace();
                        break;
                    }
                }
                }
        });
        t.start();
        System.out.println("join之前");
        Thread.sleep(3000);
        t.interrupt();
        System.out.println("join之后");
    }
}
